import { useStore } from '@tanstack/react-store';
import demoStore from '../../store/demo';
import meStore from '../../store/me';
import Button from '../../components/ui/Button';
import logoutApis from '../../apis/auth/logout';

export default function Page() {
  const count = useStore(demoStore, (state) => state.count);
  const meState = useStore(meStore, (state) => state);
  return (
    <div className="p-2">
      <h3 className="text-3xl font-bold underline">Welcome Home! {count}</h3>
      <pre>{JSON.stringify(meState, null, '  ')}</pre>
      <Button onClick={() => logoutApis.logout()}>退出登录(TODO: 退出后更新 app 状态)</Button>
    </div>
  );
}
